package com.lcz.study_designmode.行为模式.责任链模式;

/**
 * <pre>
 * <img width="128" height="110" src="https://tse3-mm.cn.bing.net/th/id/OIP-C.en-w_oH-yn2UsSRfWnOsGAHaGY?w=198&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7" alt="马刺">
 * 作者:     <a href="https://github.com/liuchuanzheng">刘传政</a>
 * 创建时间:  9:51 2022/6/20 0020
 * QQ:      1052374416
 * 电话:     18501231486
 * 描述:
 * </pre>
 */
public abstract class Handler {
    protected final static int NUM_ONE = 1;
    protected final static int NUM_THREE = 3;
    protected final static int NUM_SEVEN = 7;
    int numStart;
    int numEnd;
    Handler nextHandler;

    abstract void handleLeave(LeaveRequest leaveRequest);

    void submit(LeaveRequest leaveRequest) {
        this.handleLeave(leaveRequest);
        if (this.nextHandler != null && leaveRequest.num > this.numEnd) {
            this.nextHandler.submit(leaveRequest);
        } else {
            System.out.println("流程结束");
        }
    }
}
